import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state:{
    counter:1000,
    student:[
      {id:1,name:'kebe'},
      {id:2,name:'lili'},
      {id:3,name:'yang'},
      {id:4,name:'james'}
    ],
    info:{
      id:1,
      name:'james',
      height:1.89
    }
  },
  actions:{

  },
  mutations:{
    inc(state,num){
      state.counter+=num
    },
    dec(state){
      state.counter--
    },
    change(state){
      // 添加属性
      Vue.set(state.info,'status',1)
      // state.info['status'] = 1
      // Vue.delete(state.info,'height')
    }
  },
  getters:{
    sub(state){
      return state.counter*state.counter
    }
  },
  modules:{

  }
})
export default store
